/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.camachosanchez.bean;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Zully
 */
@Entity
@Table(name = "detalle_despinche")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetalleDespinche.findAll", query = "SELECT d FROM DetalleDespinche d"),
    @NamedQuery(name = "DetalleDespinche.findById", query = "SELECT d FROM DetalleDespinche d WHERE d.id = :id"),
    @NamedQuery(name = "DetalleDespinche.findByCantidad", query = "SELECT d FROM DetalleDespinche d WHERE d.cantidad = :cantidad"),
    @NamedQuery(name = "DetalleDespinche.findByCostoUnitario", query = "SELECT d FROM DetalleDespinche d WHERE d.costoUnitario = :costoUnitario"),
    @NamedQuery(name = "DetalleDespinche.findByCostoTotal", query = "SELECT d FROM DetalleDespinche d WHERE d.costoTotal = :costoTotal")})
public class DetalleDespinche implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "cantidad")
    private short cantidad;
    @Basic(optional = false)
    @Column(name = "costo_unitario")
    private double costoUnitario;
    @Basic(optional = false)
    @Column(name = "costo_total")
    private double costoTotal;
    @JoinColumn(name = "id_insumos_despinche", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private InsumosDespinche idInsumosDespinche;
    @JoinColumn(name = "id_despinches", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Despinches idDespinches;

    public DetalleDespinche() {
    }

    public DetalleDespinche(Long id) {
        this.id = id;
    }

    public DetalleDespinche(Long id, short cantidad, double costoUnitario, double costoTotal) {
        this.id = id;
        this.cantidad = cantidad;
        this.costoUnitario = costoUnitario;
        this.costoTotal = costoTotal;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public short getCantidad() {
        return cantidad;
    }

    public void setCantidad(short cantidad) {
        this.cantidad = cantidad;
    }

    public double getCostoUnitario() {
        return costoUnitario;
    }

    public void setCostoUnitario(double costoUnitario) {
        this.costoUnitario = costoUnitario;
    }

    public double getCostoTotal() {
        return costoTotal;
    }

    public void setCostoTotal(double costoTotal) {
        this.costoTotal = costoTotal;
    }

    public InsumosDespinche getIdInsumosDespinche() {
        return idInsumosDespinche;
    }

    public void setIdInsumosDespinche(InsumosDespinche idInsumosDespinche) {
        this.idInsumosDespinche = idInsumosDespinche;
    }

    public Despinches getIdDespinches() {
        return idDespinches;
    }

    public void setIdDespinches(Despinches idDespinches) {
        this.idDespinches = idDespinches;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleDespinche)) {
            return false;
        }
        DetalleDespinche other = (DetalleDespinche) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.camachosanchez.bean.DetalleDespinche[ id=" + id + " ]";
    }
    
}
